Redux, useSelector, useDispatch


用 hooks 取代 connect

connect => hooks
取資料: mapStateToProps => useSelector
更新資料: mapDispatchToProps => useDispatch

import { Provider, useSelector, useDispatch } from 'react-redux';
import { addTodo } from './action/todolist';







你可能感興趣的文章

VUE3 課前章節-JS 必備觀念-This的運作

VUE3 課前章節-JS 必備觀念-This的運作

DAY5:Delete occurrences of an element if it occurs more than n times

DAY5:Delete occurrences of an element if it occurs more than n times

[Note] JS: Scope & Scope Chain

[Note] JS: Scope & Scope Chain






留言討論